/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import Connect.ConnectionJDBC;
import DatabasePOJO.linhvuc;
import java.sql.ResultSet;
import java.util.ArrayList;

/**
 *
 * @author Mr-Nguyen
 */
public class linhvucDAO {
    public static ArrayList<linhvuc> getListlinhvuc(){
        
        ConnectionJDBC cnn = new ConnectionJDBC();
        ArrayList<linhvuc> arrlv = new ArrayList<linhvuc>();
        String sql = "select * from linhvuc";
        try
        {
            cnn.Connect();
            ResultSet rs = cnn.getTable(sql);
            while(rs.next()){
                 linhvuc lv = new linhvuc();
                 lv.setMaLinhVuc(String.valueOf(rs.getInt("MaLinhVuc")));
                 lv.setTenLinhVuc(rs.getString("TenLinhVuc"));
                 arrlv.add(lv);
            }
        }catch(Exception ex)
        {}
        finally
        {
            cnn.Close();
        }
        return arrlv;
    }
}
